{% if groups['master'] | length == 1 %}
    {% set apiserver = groups['master'][0] %}
{% elif groups['master'] | length > 1 %}
    {% set apiserver = vip %}
{% endif %}

apiVersion: v1
clusters:
- cluster:
    certificate-authority: {{ k8s_work_dir }}/ssl/ca.pem
    server: https://{{ apiserver }}:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: admin
  name: default
current-context: default
kind: Config
preferences: {}
users:
- name: admin
  user:
    client-certificate: {{ k8s_work_dir }}/ssl/admin.pem
    client-key: {{ k8s_work_dir }}/ssl/admin-key.pem
